package com.example.electricpower.controller;

import entity.User;
import org.springframework.web.bind.annotation.*;
import result.Result;

@RestController
@RequestMapping("/user")
public class UserController {
    @RequestMapping( "/getAllUser")

    public Result getUser(){

        return Result.ok("123456");
    }
    @RequestMapping( "/getAUser")

    public Result getUserWihtParmas(String username,String password){

        if(username==null||username.trim()==""||password==null||password.trim()==""){
          return Result.error(2000,"您输入的用户名密码有误！");
        }
        System.out.println("你好");
        System.out.println(username);
        System.out.println(password);
        return Result.ok();
    }


    @PostMapping( value = "/selectAUser")
    public String getUserWihtParmas1(@RequestBody User user){
        System.out.println(user.getName());
        System.out.println(user.getSex());
        System.out.println(user.getAge());
        return "我的名字是"+user.getName()+",我是"+user.getSex()+"的,我永远"+user.getAge()+"岁";
    }

    public static void main(String[] args){
        User user = new User();
         User user1=new User("李四",25,"男");
        System.out.println(user);

    }
}
